<script type="text/javascript" src="__PUBLIC__/javascripts/admin/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="__PUBLIC__/javascripts/admin/kindeditor/lang/zh_CN.js"></script>

<div class="contentArea">
    <div class="Item hr">
        <div class="current">添加产品</div>
    </div>
    <form id='ajaxupload' action="{:U('Product/create')}" method='post' enctype='multipart/form-data'>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table1">
            <tr>
                <th width="80">类型：</th>
                <td>
                    <select name="product[category_id]" id="category_id">
                        <volist name="categorys" id="cate">
                            <if condition="count($cate['subCategorys']) gt 0">
                                <optgroup label="{$cate['name']}"></optgroup>
                                <else/>
                                <option value="{$cate['id']}">{$cate['name']}</option>
                            </if>

                        </volist>
                        <volist name="cate['subCategorys']" id="subCate">
                            <option value="{$subCate['id']}">&nbsp;&nbsp;&nbsp;&nbsp;|--{$subCate['name']}</option>
                        </volist>
                    </select>(如果没有类型，请到<b><a href="{:U('Category/add')}">栏目管理</a></b>里创建！)
                </td>
            </tr>
            <tr>
                <th width="80">名称：</th>
                <td><input name="product[name]" type="text" class="input" size="120" value="{$product['name']}"/></td>
            </tr>
            <tr>
                <th width="80">原价：</th>
                <td><input name="product[price]" type="text" class="input" size="20" value="{$product['price']}"/>
                </td>
            </tr>
            <tr>
                <th width="80">折扣价：</th>
                <td><input name="product[discount]" type="text" class="input" size="20" value="{$product['discount']}"/>
                </td>
            </tr>
            <tr>
                <th width="80">图片：</th>
                <td>
                    <include file="Common/plupload/uploadUI" keywords="{$product['id']}"/>
                </td>
            </tr>
            <tr>
                <th width="80">概述：</th>
                <td>
                    <textarea name="product[summary]" id="summary" rows='6' cols='120'>{$product['summary']}</textarea>
                </td>
            </tr>
            <tr>
                <th width="80">详情：</th>
                <td>
                    <textarea name="product[content]" id="content" rows='25' cols='120'>{$product['content']}</textarea>
                </td>
            </tr>
        </table>
        <input type="hidden" name="product[id]" value="{$product['id']}" />
    </form>
    <div class="commonBtnArea">
        <button class="btn submit">提交</button>
        <button class="btn goBack">返回</button>
    </div>
</div>
<include file="Product:javascript" />
<script type="text/javascript">
    $(function () {

        $("#category_id").val("{$product['category_id']}");
        $(".submit").click(function(){
            commonAjaxSubmit("{:U('Product/update')}");
            return false;
        });

    });

</script>

